package com.fantasy.regEx.test;

import org.junit.Test;

/**
 * @author  Fantasy
 * @E-mail: vi2014@qq.com
 * @version ����ʱ�䣺2014��9��16�� ����1:48:47
 * */
public class 去掉字符串最后字符 {

	@Test
	public void test(){
	    String str = "I last year \r\nbuy a watch.\r\n\r\n\r\n, ";
	    // \r\n for Windows; \n for Unix; \r for Mac
	    String s=str.replaceAll("(?:\r\n|\n|\r| |,)*$", ""); 
	    System.out.println(s);
	}
	
	@Test
	public void test1(){
	    String str = "I last year \r\nbuy a watch.,";
	    // \r\n for Windows; \n for Unix; \r for Mac
	    String s=str.replaceAll("(?:,)*$", ""); 
	    System.out.println(s);
	}
}
